<!doctype html>
<html>
  <title>startActivity Handle Input Data</title>
  <script src="/lib/webintents.debug.js"></script>
  <script>
    document.addEventListener("DOMContentLoaded", function() {
      var regBtn = document.getElementById("register");
      regBtn.addEventListener("click", function() {
        window.navigator.register("http://webintents.org/share", undefined); 
      }, false);
      
      var startButton = document.getElementById("startActivity");
      startButton.addEventListener("click", function() {
        var intent = new Intent();
        intent.action = "http://webintents.org/share";
  
        window.navigator.startActivity(intent);
      }, false);

      window.navigator.onActivity = function(data) {
        var output = document.getElementById("output");
        output.textContent = JSON.stringify(data);
      };
    }, false);
  </script>
  <body>
    <button id="register">Click to Register Handler</button>
    <button id="startActivity">Click to Start Activity</button>
    <div id="output"></div>
  </body>
</html>
